package day8.homework;

import javax.swing.text.ParagraphView;

//有三个线程A，B，C，每个线程只打印线程名
//保证三个线程的执行顺序永远是 A -->B-->C
public class PrintMess extends Thread{
    public static void main(String[] args) {
        Thread a = new Thread(()-> {
            System.out.println(Thread.currentThread().getName());
        },"A");
        Thread b = new Thread(()-> {
            try {
                a.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName());
        },"B");
        Thread c = new Thread(()-> {
            try {
                b.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName());
        },"C");
        a.start();
        b.start();
        c.start();
    }
}
